package com.trkj.pojos;

import java.io.Serializable;
import javax.persistence.*;

import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;


/**
 * The persistent class for the EQUIP_PLAN database table.
 * 
 */
@Entity
@Table(name="EQUIP_PLAN")
@NamedQuery(name="EquipPlan.findAll", query="SELECT e FROM EquipPlan e")
public class EquipPlan implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue=1, allocationSize=1, name="EPLAN__EPLANID_GENERATOR", sequenceName="SEQ2")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="EPLAN__EPLANID_GENERATOR")
	@Column(name="EPLAN_ID")
	private long eplanId;

	@Column(name="EPLAN_AUTHOR")
	private String eplanAuthor;

	@Temporal(TemporalType.DATE)
	@DateTimeFormat(pattern="yyyy-MM-dd")
	@Column(name="EPLAN_DATE")
	private Date eplanDate;

	@Column(name="EPLAN_DEPT")
	private String eplanDept;

	@Column(name="EPLAN_TITLE")
	private String eplanTitle;

	@Column(name="EPLAN_TYPE")
	private String eplanType;
	
	@Column(name="EPLAN_STATE")
	private String eplanState;

	public String getEplanState() {
		return eplanState;
	}

	public void setEplanState(String eplanState) {
		this.eplanState = eplanState;
	}

	//bi-directional many-to-one association to EplanDetail
	@OneToMany(mappedBy="equipPlan")
	private List<EplanDetail> eplanDetails;

	public EquipPlan() {
	}

	public long getEplanId() {
		return this.eplanId;
	}

	public void setEplanId(long eplanId) {
		this.eplanId = eplanId;
	}

	public String getEplanAuthor() {
		return this.eplanAuthor;
	}

	public void setEplanAuthor(String eplanAuthor) {
		this.eplanAuthor = eplanAuthor;
	}

	public Date getEplanDate() {
		return this.eplanDate;
	}

	public void setEplanDate(Date eplanDate) {
		this.eplanDate = eplanDate;
	}

	public String getEplanDept() {
		return this.eplanDept;
	}

	public void setEplanDept(String eplanDept) {
		this.eplanDept = eplanDept;
	}

	public String getEplanTitle() {
		return this.eplanTitle;
	}

	public void setEplanTitle(String eplanTitle) {
		this.eplanTitle = eplanTitle;
	}

	public String getEplanType() {
		return this.eplanType;
	}

	public void setEplanType(String eplanType) {
		this.eplanType = eplanType;
	}

	public List<EplanDetail> getEplanDetails() {
		return this.eplanDetails;
	}

	public void setEplanDetails(List<EplanDetail> eplanDetails) {
		this.eplanDetails = eplanDetails;
	}

	public EplanDetail addEplanDetail(EplanDetail eplanDetail) {
		getEplanDetails().add(eplanDetail);
		eplanDetail.setEquipPlan(this);

		return eplanDetail;
	}

	public EplanDetail removeEplanDetail(EplanDetail eplanDetail) {
		getEplanDetails().remove(eplanDetail);
		eplanDetail.setEquipPlan(null);

		return eplanDetail;
	}

}